From 14a97cb23949ac6f536973a061a035a63d718fbc Mon Sep 17 00:00:00 2001 From: "kaf24@scramble.cl.cam.ac.uk" Date: Wed, 14 Jul 2004 15:26:41 +0000 Subject: [PATCH] bitkeeper revision 1.1084 (40f550b1_LIi9erer0DqFiK5Y96wdA) Bugfix --- tools/libxc/xc_linux_build.c | 12 ++++++------ xen/common/elf.c | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tools/libxc/xc_linux_build.c b/tools/libxc/xc_linux_build.c index e2edd81e17..23ec09cb09 100644 --- a/tools/libxc/xc_linux_build.c +++ b/tools/libxc/xc_linux_build.c @@ -560,7 +560,7 @@ static int parseelfimage(char *elfbase, Elf_Phdr *phdr; Elf_Shdr *shdr; unsigned long kernstart = ~0UL, kernend=0UL; - char *shstrtab, *guestinfo, *p; + char *shstrtab, *guestinfo=NULL, *p; int h; if ( !IS_ELF(*ehdr) ) @@ -608,13 +608,9 @@ static int parseelfimage(char *elfbase, return -EINVAL; } - *pvirtstart = kernstart; - if ( (p = strstr(guestinfo, "VIRT_BASE=")) != NULL ) - *pvirtstart = strtoul(p+10, &p, 0); - break; } - if ( h == ehdr->e_shnum ) + if ( guestinfo == NULL ) { ERROR("Not a Xen-ELF image: '__xen_guest' section not found."); return -EINVAL; @@ -639,6 +635,10 @@ static int parseelfimage(char *elfbase, return -EINVAL; } + *pvirtstart = kernstart; + if ( (p = strstr(guestinfo, "VIRT_BASE=")) != NULL ) + *pvirtstart = strtoul(p+10, &p, 0); + *pkernstart = kernstart; *pkernend = kernend; *pkernentry = ehdr->e_entry; diff --git a/xen/common/elf.c b/xen/common/elf.c index b59171b5d9..d5912fe341 100644 --- a/xen/common/elf.c +++ b/xen/common/elf.c @@ -27,7 +27,7 @@ int parseelfimage(char *elfbase, Elf_Phdr *phdr; Elf_Shdr *shdr; unsigned long kernstart = ~0UL, kernend=0UL; - char *shstrtab, *guestinfo, *p; + char *shstrtab, *guestinfo=NULL, *p; int h; if ( !IS_ELF(*ehdr) ) @@ -75,13 +75,9 @@ int parseelfimage(char *elfbase, return -EINVAL; } - *pvirtstart = kernstart; - if ( (p = strstr(guestinfo, "VIRT_BASE=")) != NULL ) - *pvirtstart = simple_strtoul(p+10, &p, 0); - break; } - if ( h == ehdr->e_shnum ) + if ( guestinfo == NULL ) { printk("Not a Xen-ELF image: '__xen_guest' section not found.\n"); return -EINVAL; @@ -106,6 +102,10 @@ int parseelfimage(char *elfbase, return -EINVAL; } + *pvirtstart = kernstart; + if ( (p = strstr(guestinfo, "VIRT_BASE=")) != NULL ) + *pvirtstart = simple_strtoul(p+10, &p, 0); + *pkernstart = kernstart; *pkernend = kernend; *pkernentry = ehdr->e_entry; -- 2.30.2